#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
#include <string>

int main()
{
	string s("abcdefg");
    int count = 0;
    int k = 2;
    int l, r;
    int i;
    for (i = 0; i < s.size(); i++)
    {
        count++;
        if (count == 2 * k)
        {
            l = i - count + 1;
            r = l + k;
            reverse(s.begin() + l, s.begin() + r);
            count = 0;
        }
    }
    l = i - count;
    if (count <= k)
    {
        reverse(s.begin() + l, s.end());
    }
    else
    {
        r = l + k;
        reverse(s.begin() + l, s.begin() + r);
    }


	cout << s;
    return 0;
}